package com.wantong.jianpu.adapters;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.wantong.jianpu.R;
import com.wantong.jianpu.beans.SelectImageBean;
import com.wantong.jianpu.utils.ImageUtils;


/**
 * @author PACY
 * @date 2022/4/21
 * description:
 */
public class SelectImageAdapter extends BaseQuickAdapter<SelectImageBean,BaseViewHolder> {
    private ImageView imageView;
    public SelectImageAdapter() {
        super(R.layout.select_image_item_view);
    }

    @Override
    protected void convert(BaseViewHolder holder, SelectImageBean s) {
        imageView=holder.getView(R.id.image_iv);
        if(s.isAdd()){
            ImageUtils.loadImage(R.drawable.upload_image,imageView);
        }else{
            if(s.isNet()){
                ImageUtils.loadImage(s.getUrl(),imageView);
            }else{
                ImageUtils.loadImage(s.getPath(),imageView);
            }

        }
        holder.setGone(R.id.delete_iv,s.isAdd());
    }
}
